package com.leetcode.tree;

/**
 * @Author zhang.xin
 * @Description: TODO(这里描述)
 * @Date 2019/12/30
 */
public class Leetcode100 {

    public boolean isSameTree(TreeNode p, TreeNode q) {
        if (p == null && q == null)
            return true;

        if (p == null || q == null)
            return false;

        if (p.val != q.val) {
            return false;
        } else {
            return isSameTree(p.left, q.left)
                    && isSameTree(p.right, q.right);
        }
    }
}
